package org.mappland.compltres.controller.user;

import org.mappland.compltres.common.CommonResult;
import org.mappland.compltres.common.StatusCode;
import org.mappland.compltres.domain.Type;
import org.mappland.compltres.service.TypeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

// 展示所有机型
@RestController
@RequestMapping("/user")
public class TypeController {
    @Resource
    private TypeService typeService;

    @GetMapping("/listTypes")
    public CommonResult<List<Type>> listTypes() {
        CommonResult<List<Type>> result = new CommonResult<>();

        List<Type> list = typeService.list();

        result.setData(list);
        result.setCode(StatusCode.COMMON_SUCCESS.getCode());
        result.setMessage(StatusCode.COMMON_SUCCESS.getMessage());
        return result;
    }
}
